/*
 * MemMonitor_F.h
 *
 *  Created on: Aug 30, 2012
 *      Author: finder
 */

#ifndef __MEMMONITOR_F_H__
#define __MEMMONITOR_F_H__

#include <stdio.h>
//#include "Thread_F.h"
#include "thread_f.h"

class mem_monf_t
{
protected:
	FILE*			m_pFileReport;
	__useconds_t	m_dwUSecond;
	__pid_t			m_iPID;
	int				m_bMonitorLoop;
	threadf_t		m_ThMonitor;
	string			_snapshot_info;

public:
	mem_monf_t();
	virtual ~mem_monf_t();

	int init(FILE* log,__useconds_t log_intv,int pid);

	int set_recordfile(FILE* log);
	int set_record_intv(__useconds_t log_intv);
	int set_record_pid(int pid);

	int start();
	int pause();
	int resume();
	int stop();

protected:
	static void* MonitorThread(void* pData);
	void* MonitorImpl();

	const char* dump_snapshot();
};


#endif /* __MEMMONITOR_F_H__ */
